﻿using Microsoft.Extensions.Logging;
using Simple.Framework.Schedule;
using Simple.Tools;
using SimpleNet.Handle;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TEST.IRepository;

/*********************************************************
 * 命名空间 SimpleNet.example.schedule
 * 接口名称 VersionSchedule
 * 开发人员：zdm
 * 创建时间：2023/12/12 14:34:15
 * 描述说明：
 * 更改历史：
 * 
 * *******************************************************/
namespace SimpleNet.example.schedule
{
	internal class VersionSchedule : BaseSchedule
	{

		[Autowired]

		public StringMessageHandle messageHandle { get; set; }
		[Autowired]
		public TestConfiguration configuration { get; set; }
		[Autowired]
		protected ILogger<VersionSchedule> logger { get; set; }

		[Autowired("MySqlConnection")]
		public string test { get; set; }

		[Autowired]
		public IUserRepository userRepository { get; set; }

		[Autowired]

		public IRoleRepository roleRepository { get; 
			set; }

        [Autowired]
        public TestUser testuser { get; set; }

	
		[Autowired]
		public IClientManager clientManager { get; set; }
        public VersionSchedule() {

			ScheduleInfo.IsAsync=true;
			ScheduleInfo.SetWholeTime(1,10);
		}

		public override void Init()
		{
			
		}

		public override void Run()
		{
		}

		public override async Task RunAsync()
		{
			try
			{
				clientManager.GetClientCount();
				logger.LogInformation("count:" + clientManager.GetClientCount().ToString());
				logger.LogInformation("threadcount:" + ThreadPool.ThreadCount);


			}
			catch (Exception ex)
			{
				logger.LogError(ex.Message);
				logger.LogError(ex.StackTrace);
			}
		
        
		}
	}
}
